package com.china08.yxyapi.util;

import org.apache.commons.lang.StringUtils;

import com.googlecode.htmlcompressor.compressor.HtmlCompressor;

public class HtmlCompressorUtil {

    public static String HtmlCompressor(String string) {
        if (StringUtils.isBlank(string)) { return null; }
        HtmlCompressor compressor = new HtmlCompressor();
        compressor.setEnabled(true);
        compressor.setRemoveComments(true);
        compressor.setRemoveMultiSpaces(true);
        compressor.setRemoveIntertagSpaces(true);
        compressor.setRemoveQuotes(true);
        compressor.setCompressCss(true);
        compressor.setCompressJavaScript(true);
        compressor.setYuiCssLineBreak(80);
        compressor.setYuiJsDisableOptimizations(true);
        compressor.setYuiJsLineBreak(-1);
        compressor.setYuiJsNoMunge(true);
        compressor.setYuiJsPreserveAllSemiColons(true);
        return compressor.compress(string);
    }
}
